package edu.ccut.titan.tag.chart.utils;

import java.util.List;

import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.PlotOrientation;

import edu.ccut.titan.tag.chart.render.TitanChartRenderManager;

/**
 * 记录图表信息
 * 
 * @author LeslieGu
 *
 */
public class ChartInfo {
    public static final int DEFAULT_WIDTH = 640;
    public static final int DEFAULT_HEIGHT = 480;

    public static final int LARGE_WIDTH = 4096;
    public static final int MIDDLE_WIDTH = 2048;
    public static final int SMALL_WIDTH = 1024;

    public static final String BAR_CHART = "barChart";
    public static final String PIE_CHART = "pieChart";
    public static final String MULTI_PIE_CHART = "multiPieChart";
    public static final String LINE_CHART = "lineChart";
    public static final String TIME_SERIES_CHART = "timeSeriesChart";
    public static final String MULTI_CHART = "multiplyChart";

    private String title; //标题
    
    private String subTitle; //子标题
    
    private String categoryAxisLable; //类型轴标题
    
    private String categoryAxislablePosition;
    
    private String numberAxisLable; //数字轴标题
    
    private List<List<?>> datas;
    
    private List<SubAixs> subAixses;
    
    private PlotOrientation orientation;
    
    private boolean legend;
    
    private boolean tooltips;
    
    private boolean urls;
    
    private String type; //图表类型;
    
    private int width;
    
    private int height;
    
    private boolean naked;
    
    public ChartInfo() {
        this(null, null, null, "STANDARD", null, null, PlotOrientation.VERTICAL, true, true, false,
                null, false);
        
    }

    public ChartInfo(String title, String subTitle, String categoryAxisLable, String categeoryAixsLablePosition, String numberAxisLable,
                     List<List<?>> datas, PlotOrientation orientation, boolean legend, boolean tooltips,
                     boolean urls, String type, boolean naked) {
        this.title = title;
        this.subTitle = subTitle;
        this.categoryAxisLable = categoryAxisLable;
        this.numberAxisLable = numberAxisLable;
        this.datas = datas;
        this.orientation = orientation;
        this.legend = legend;
        this.tooltips = tooltips;
        this.urls = urls;
        this.type = type;
        this.width = ChartInfo.DEFAULT_WIDTH;
        this.height = ChartInfo.DEFAULT_HEIGHT;
        this.naked = naked;
        this.categoryAxislablePosition = categeoryAixsLablePosition;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getSubTitle() {
        return subTitle;
    }

    public void setSubTitle(String subTitle) {
        this.subTitle = subTitle;
    }

    public String getCategoryAxisLable() {
        return categoryAxisLable;
    }

    public void setCategoryAxisLable(String categoryAxisLable) {
        this.categoryAxisLable = categoryAxisLable;
    }

    public String getNumberAxisLable() {
        return numberAxisLable;
    }

    public void setNumberAxisLable(String numberAxisLable) {
        this.numberAxisLable = numberAxisLable;
    }

    public PlotOrientation getOrientation() {
        return orientation;
    }

    public void setOrientation(PlotOrientation orientation) {
        this.orientation = orientation;
    }

    public boolean isLegend() {
        return legend;
    }

    public void setLegend(boolean legend) {
        this.legend = legend;
    }

    public boolean isTooltips() {
        return tooltips;
    }

    public void setTooltips(boolean tooltips) {
        this.tooltips = tooltips;
    }

    public boolean isUrls() {
        return urls;
    }

    public void setUrls(boolean urls) {
        this.urls = urls;
    }

    public int getWidth() {
        return width;
    }

    public void setWidth(int width) {
        this.width = width;
    }

    public int getHeight() {
        return height;
    }

    public void setHeight(int height) {
        this.height = height;
    }

    public boolean isNaked() {
        return naked;
    }

    public void setNaked(boolean naked) {
        this.naked = naked;
    }

	public List<List<?>> getDatas() {
		return datas;
	}

	public void setDatas(List<List<?>> datas) {
		this.datas = datas;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}
	
	public JFreeChart getChart() {
		return TitanChartRenderManager.getInstance().getChart(this);
	}

	public List<SubAixs> getSubAixses() {
		return subAixses;
	}

	public void setSubAixses(List<SubAixs> subAixses) {
		this.subAixses = subAixses;
	}

	public String getCategoryAxislablePosition() {
		return categoryAxislablePosition;
	}

	public void setCategoryAxislablePosition(String categoryAxislablePosition) {
		this.categoryAxislablePosition = categoryAxislablePosition;
	}
}
